import axios from 'axios'

const baseUrl = 'http://192.168.88.177:9875'

export const getResultPage = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getProjectResultPage'
  return axios.post(url, queryParams, {
    headers: { 'Content-Type': 'application/json; charset=UTF-8' },
  })
}

// /api/v1/dataAnalysis/getQueryOperationEnumList
export const getQueryOperationEnumList = () => {
  const url = baseUrl + '/api/v1/dataAnalysis/getQueryOperationEnumList'
  return axios.get(url)
}

// /api/v1/dataAnalysis/getSearchList
export const getSearchList = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getSearchList'
  return axios.post(url, queryParams)
}

///api/v1/dataAnalysis/exportProjectResultExcel
export const exportProjectResultExcel = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/exportProjectResultExcel'
  return axios.post(
    url,
    queryParams,
    { responseType: 'blob' },
    { headers: { 'Content-Type': 'application/json' } },
  )
}

// /api/v1/dataDashboard/exportTownProjectStatsByBusinessPhase
export const exportTownProjectStatsByBusinessPhase = (queryParams) => {
  const url = baseUrl + '/api/v1/dataDashboard/exportTownProjectStatsByBusinessPhase'
  const params = new URLSearchParams(queryParams)
  return axios.post(url, params.toString(), {
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
    },
  })
}

///api/v1/dataAnalysis/getYearsForWcsj
export const getYearsForWcsj = (params) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getYearsForWcsj'
  return axios.post(url, params)
}

// /api/v1/dataAnalysis/getMonthCountForDs
export const getMonthCountForDs = (params) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getMonthCountForDs'
  return axios.post(url, params)
}

// /api/v1/dataAnalysis/getMonthCountForZjzmj
export const getMonthCountForZjzmj = (params) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getMonthCountForZjzmj'
  return axios.post(url, params)
}

// /api/v1/dataAnalysis/getCountByDistrict
export const getCountByDistrict = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getCountByDistrict'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getZygnGroupCount
export const getZygnGroupCount = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getZygnGroupCount'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getZjzmjCountGroupByLg
export const getZjzmjCountGroupByLg = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getZjzmjCountGroupByLg'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getZjzmjCountGroupByCs
export const getZjzmjCountGroupByCs = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getZjzmjCountGroupByCs'
  return axios.post(url, queryParams)
}

///api/v1/dataAnalysis/getProjectResultIndex
export const getProjectResultIndex = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getProjectResultIndex'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getProjectRangeGeometry
export const getProjectRangeGeometry = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getProjectRangeGeometry'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getDataForSmid
export const getDataForSmid = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getDataForSmid'
  return axios.post(url, queryParams)
}

export const runFme = (params) => {
  const url = 'http://192.168.88.177:8084/online/api/run'
  return axios.post(url, params, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
  })
}

export const getFmeRange = (uuid) => {
  const url = 'http://192.168.88.177:8084/online/guidang/gd_getRangeByUUID'
  return axios.get(url, { params: { uuid: uuid } })
}

export const uploadShp = baseUrl + '/api/v1/dataAnalysis/getWktForUploadShp'

// /api/v1/dataDashboard/importBaiyunProjectExcel
export const importBaiyunProjectExcel = baseUrl + '/api/v1/dataDashboard/importBaiyunProjectExcel'

// /api/v1/dataAnalysis/getMasterPlanStatistics
export const getMasterPlanStatistics = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getMasterPlanStatistics'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getMasterPlanMonthStatistics
export const getMasterPlanMonthStatistics = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getMasterPlanMonthStatistics'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getMasterPlanCountByDistrict
export const getMasterPlanCountByDistrict = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getMasterPlanCountByDistrict'
  return axios.post(url, queryParams)
}

// /api/v1/dataAnalysis/getAirportHeightRestrictionAnalysis
export const getAirportHeightRestrictionAnalysis = (queryParams) => {
  const url = baseUrl + '/api/v1/dataAnalysis/getAirportHeightRestrictionAnalysis'
  return axios.post(url, queryParams)
}
